package com.base.cn.platform.os.service.course.qa.qatype;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.course.CourseBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 问答分类service
 * @author LIZHIPENG
 * @since 2018/4/18
 */
@FeignClient(name = CourseBaseService.appName ,configuration = FeignAuthConfig.class)
public interface QaTypeService extends CourseBaseService{

    /**
     * 条件查询问答分类数量
     * @param qaType
     * @return
     */
    @RequestMapping(contextPath + "/qaTypeCount")
    BigDecimal count(@RequestBody Map<String, Object> qaType);

    /**
     * 分页查询问答分类列表
     * @param currentPage
     * @param qaType
     * @return
     */
    @RequestMapping(contextPath + "/queryQaTypeListPage")
    Map<String, Object> queryQaTypeListPage(@RequestParam(value = "currentPage", required = false, defaultValue = "1") int currentPage,
                                            @RequestBody Map<String, Object> qaType);

    /**
     * 多条件查询问答分类
     * @param condition
     * @return
     */
    @RequestMapping(contextPath + "/queryQaTypeList")
    List<Map<String, Object>> queryQaTypeList(@RequestBody Map<String, Object> condition);

    /**
     * 新建或修改问答分类
     * @param qaType
     * @return
     */
    @RequestMapping(contextPath + "/saveOrUpdateQaType")
    Map<String, Object> saveOrUpdateQaType(@RequestBody Map<String, Object> qaType);

    /**
     * 根据ID查询问答分类
     * @param qaTypeId
     * @return
     */
    @RequestMapping(contextPath + "/findQaTypeById")
    Map<String, Object> findQaTypeById(@RequestParam("qaTypeId") BigDecimal qaTypeId);

    /**
     * 修改问答分类状态
     * @param qaTypeIds 问答分类ID串
     * @param status 状态：1.恢复，2.禁用，3.删除
     * @return
     */
    @RequestMapping(contextPath + "/updateQaTypeStatus")
    Map<String, Object> updateQaTypeStatus(@RequestParam("qaTypeIds") String qaTypeIds,
                                           @RequestParam("status") Integer status);

    /**
     * 修改问答分类的讲师数量
     * @param newQaTypeId 新的问答分类ID
     * @param oldQaTypeId 老的问答分类ID
     */
    @RequestMapping(contextPath + "/updateTeacherNum")
    void updateTeacherNum(@RequestParam(value = "newQaTypeId", required = false) BigDecimal newQaTypeId,
                          @RequestParam(value = "oldQaTypeId", required = false) BigDecimal oldQaTypeId);

    /**
     * 通过老师ID，获取老师对象的问答类型对象
     * @param teacherId 老师ID
     * @return QaType
     */
    @RequestMapping(contextPath + "/findQaTypeByTeacherId")
    Map<String, Object> findQaTypeByTeacherId(@RequestParam("teacherId") BigDecimal teacherId);
}
